home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / Virtual.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  6.7 KB  |  244 lines

  1. /* The power of Virtgroup */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call HandleApp
  9. /* never reached */
  10. /***********************************************************************/
  11. init: procedure
  12.     l="rmh.library";if ~show("L",l) then;if ~AddLib(l,0,-30) then exit
  13.     if AddLibrary("rexxsupport.library","rxmui.library")~=0 then exit
  14.     call RxMUIOpt("DebugMode ShowErr")
  15.     return
  16. /***********************************************************************/
  17. MakePage1: procedure
  18.  
  19.     text1=ParseText("
  20. %iHello User !%n\n
  21. \n
  22. This could be a very long text and you are looking\n
  23. at it through a %uvirtual group%n. Please use the\n
  24. scrollbars at the right and bottom of the group to\n
  25. move the visible area either vertically or\n
  26. horizontally. While holding down the small arrow\n
  27. button between both scrollbars, the display will\n
  28. follow your mouse moves.\n
  29. \n
  30. If you click somewhere into a %uvirtual group%n and\n
  31. move the mouse across one of its borders, the group will\n
  32. start scrolling. If you are lucky and own a middle mouse\n
  33. button, you may also want to press it and try moving.\n
  34. \n
  35. When the surrounding window is big enough for the\n
  36. complete virtual group to fit, the scrollers and\n
  37. the move button get disabled.\n
  38. \n
  39. Since this %uvirtual group%n does only contain a\n
  40. single text object, it's a rather simple example.\n
  41. In fact, virtual groups are a lot more powerful,\n
  42. they can contain any objects you like.\n
  43. \n
  44. Note to 7MHz/68000 users: Sorry if you find this\n
  45. thingy a bit slow. Clipping in virtual groups can\n
  46. get quite complicated. Please don't blame me,\n
  47. blame your 'out of date' machine! :-)\n
  48. \n
  49. %i%cHave fun, Stefan.%n%l\n\n")
  50.  
  51.     v.frame="virtual"
  52.     v.UseWinBorder=1
  53.      v.0="t0"
  54.       t0.class="text"
  55.       t0.background="textback"
  56.       t0.contents=text1
  57.  
  58.     res=NewObj("scrollgroup","page1","v")
  59.     if res~=0 then call err(res)
  60.  
  61.     return "page1"
  62. /***********************************************************************/
  63. MakeImagesGroup: procedure
  64.     g.frame="group"
  65.     g.background="groupback"
  66.     g.FrameTitle="Images"
  67.     g.horiz=1
  68.      g.0=hspace()
  69.      g.1="g1"
  70.       g1.class="group"
  71.       g1.columns=2
  72.         do i=0 to 9
  73.             g1.i="im"i;
  74.             interpret "IM"i".CLASS=image"
  75.             interpret 'IM'i'.SPEC='i+11
  76.         end
  77.      g.2=hspace()
  78.     return xnewobj("group",,"g")
  79. /***********************************************************************/
  80. MakeBackgroundsGroup: procedure
  81.     gg.frame="group"
  82.     gg.background="groupback"
  83.     gg.FrameTitle="Backgrounds"
  84.     gg.horiz=1
  85.      gg.0=hspace()
  86.      gg.1="g"
  87.      g.class="group"
  88.      g.columns=3
  89.      g.0="rec0"
  90.       rec0.class="rectangle"
  91.       rec0.frame="text"
  92.       rec0.background="background"
  93.       rec0.fixwidth=32
  94.      g.1="rec1"
  95.       rec1.class="rectangle"
  96.       rec1.frame="text"
  97.       rec1.background="fill"
  98.       rec1.fixwidth=32
  99.      g.2="rec2"
  100.       rec2.class="rectangle"
  101.       rec2.frame="text"
  102.       rec2.background="shadow"
  103.       rec2.fixwidth=32
  104.      g.3="rec3"
  105.       rec3.class="rectangle"
  106.       rec3.frame="text"
  107.       rec3.background="shadowback"
  108.       rec3.fixwidth=32
  109.      g.4="rec4"
  110.       rec4.class="rectangle"
  111.       rec4.frame="text"
  112.       rec4.background="shadowfill"
  113.       rec4.fixwidth=32
  114.      g.5="rec5"
  115.       rec5.class="rectangle"
  116.       rec5.frame="text"
  117.       rec5.background="shadowshine"
  118.       rec5.fixwidth=32
  119.      g.6="rec6"
  120.       rec6.class="rectangle"
  121.       rec6.frame="text"
  122.       rec6.background="fillback"
  123.       rec6.fixwidth=32
  124.      g.7="rec7"
  125.       rec7.class="rectangle"
  126.       rec7.frame="text"
  127.       rec7.background="shineback"
  128.       rec7.fixwidth=32
  129.      g.8="rec8"
  130.       rec8.class="rectangle"
  131.       rec8.frame="text"
  132.       rec8.background="fillshine"
  133.       rec8.fixwidth=32
  134.      gg.2=hspace()
  135.     return XNewObj("group",,"gg")
  136. /***********************************************************************/
  137. MakeVirtInVirt: procedure
  138.       sch.Frame="group"
  139.       sch.FrameTitle="Virtual in virtual"
  140.       sch.virtgroupcontents="vgh"
  141.        vgh.class="virtgroup"
  142.        vgh.frame="virtual"
  143.        vgh.columns=2
  144.         vgh.0=label("Name:")
  145.         vgh.1="t0"
  146.          t0.class="text"
  147.          t0.frame="text"
  148.          t0.background="textback"
  149.          t0.contents="ppp0"
  150.         vgh.2=label("Ontime:")
  151.         vgh.3="t1"
  152.          t1.class="text"
  153.          t1.frame="text"
  154.          t1.background="textback"
  155.          t1.contents="02:34:56"
  156.         vgh.4=label("Rate:")
  157.         vgh.5="t2"
  158.          t2.class="text"
  159.          t2.frame="text"
  160.          t2.background="textback"
  161.          t2.contents="64 Kb"
  162.         vgh.6=label("Traffic:")
  163.         vgh.7="t3"
  164.          t3.class="text"
  165.          t3.frame="text"
  166.          t3.background="textback"
  167.          t3.contents="122,45 Mb"
  168.     return XNewObj("scrollgroup",,"sch")
  169. /***********************************************************************/
  170. MakePage2: procedure
  171.  
  172.    sg.VirtgroupContents="v"
  173.     v.class="Virtgroup"
  174.     v.frame="virtual"
  175.  
  176.      v.0=text(,ParseText("
  177. %cAs you can see, this virtual group contains a\n
  178. lot of different objects. The (virtual) width\n
  179. and height of the virtual group are automatically\n
  180. calculated from the default width and height of\n
  181. the virtual groups contents."))
  182.  
  183.  
  184.      v.1="g0"
  185.       g0.class="group"
  186.       g0.horiz=1
  187.        g0.0=MakeImagesGroup()
  188.        g0.1=MakeBackgroundsGroup()
  189.  
  190.      v.2=MakeVirtInVirt()
  191.  
  192.     res=NewObj("scrollgroup","page2","sg")
  193.     if res~=0 then call err(res)
  194.  
  195.     return "page2"
  196. /***********************************************************************/
  197. HandleApp: procedure  expose global.
  198.     ctrl_c=2**12
  199.     do forever
  200.         call NewHandle("APP","H",ctrl_c)
  201.         if and(h.signals,ctrl_c)>0 then exit
  202.         select
  203.             when h.event="QUIT" then exit
  204.             otherwise nop
  205.         end
  206.     end
  207. /***********************************************************************/
  208. CreateApp: procedure expose global.
  209.  
  210.     app.title="VirtualDemo"
  211.     app.version="$VER: VirtualDemo 1.1 (25.1.2002)"
  212.     app.copyright="©2002, alfie"
  213.     app.author="alfie"
  214.     app.description="Show virtual groups."
  215.     app.base="VIRTUALDEMO"
  216.     app.SubWindow="mwin"
  217.  
  218.      mwin.title="Virtual Groups"
  219.      mwin.ID="VIRT"
  220.      mwin.UseRightBorderScroller=1
  221.      mwin.UseBottomBorderScroller=1
  222.      mwin.contents="mgroup"
  223.  
  224.       mgroup.0="dummy"
  225.        dummy.class="group"
  226.        dummy.0="reg"
  227.         reg.Class="Register"
  228.         reg.Titles="Page1|Page2"
  229.          reg.0=MakePage1()
  230.          reg.1=MakePage2()
  231.  
  232.     if NewObj("application","app")>0 then exit
  233.  
  234.     call Notify("mwin","CloseRequest",1,"app","ReturnID","quit")
  235.  
  236.     call set("mwin","open",1)
  237.  
  238.     return
  239. /***********************************************************************/
  240. halt:
  241. break_c:
  242.     exit
  243. /**************************************************************************/
  244.